package com.study.array;

import java.util.Arrays;

/**
 * @author ytj
 * @date 2021/12/28
 */
public class Method9 {
    public static void main(String[] args) {
        int[] numbers={-1,0};
        int[] result=twoSum(numbers,-1);
        Arrays.stream(result).forEach(System.out::println);
    }

    public static int[] twoSum(int[] numbers, int target) {
        int[] result=new int[2];
        for(int i=0;i<numbers.length;i++){
            for(int j=i+1;j<numbers.length;j++){
                if(target==numbers[i]+numbers[j]){
                    result[0]=i+1;
                    result[1]=j+1;
                }
            }
        }
        return result;
    }

}
